package com.quanquan.store.repository;

import com.quanquan.store.entity.Adsence;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;

import java.util.List;

/**
 * @ClassName:AdsenseRepository
 * @Description:TODO
 * @Author:xiongjunbao
 * @Date:2019/3/14 9:18
 * @Version 1.0
 */
public interface AdsenceRepository extends JpaRepository<Adsence,String>, JpaSpecificationExecutor<Adsence> {

    @Query(value = "SELECT * FROM oo_adsence WHERE id = ?1 AND status_remove = 0 ",nativeQuery = true)
    Adsence findByAdsenceId(String id);

    @Query(value = "SELECT * FROM oo_adsence WHERE banner_type = ?1 AND status_show = ?2 AND status_remove = 0 limit ?3,?4",nativeQuery = true)
    List<Adsence> findByBannerType(Integer bannerType, Integer statusShow, Integer count, Integer size);
}
